<!--  厂家-无法维修 -->
<template>
	<ListLayout>
		<!-- 维修情况 -->
		<HandleMaintenanceCard ref="HandleMaintenanceCard"></HandleMaintenanceCard>
		<template #footer>
			<HButtonGroup @leftClick="onCancel" @rightClick="onSubmit">
				<template #left>
					取消
				</template>
				<template #right>
					确认无法维修
				</template>
			</HButtonGroup>
		</template>
	</ListLayout>
</template>

<script>
	import ListLayout from '@/components/layout/listLayout.vue'
	import HButtonGroup from '@/components/buttonGroup/groupTwo.vue'
	import HandleMaintenanceCard from '@/components/card/sendRepair/factory/info/handleMaintenance.vue'
	import ReapirApi from '@/apis/repair.js'
	import SendRepairRouterConfig from '@/sendRepair/routerConfig.js'
	export default {
		components: {
			ListLayout,
			HandleMaintenanceCard,
			HButtonGroup,
		},
		data() {
			return {
				routerParams: {
					id: ''
				}
			}
		},
		onLoad(query) {
			console.log('onLoad', query);
			const {
				id
			} = query
			this.$set(this.routerParams, 'id', id)
		},
		methods: {
			onCancel() {
				wx.navigateBack()
			},
			async onSubmit() {
				let {
					formData
				} = this.$refs.HandleMaintenanceCard.$data

				let params = {
					repairId: this.routerParams.id,
					...formData
				}
				await ReapirApi.factory.confirmDeviceRepair(params)
				wx.showToast({
					title: '提交成功!',
					icon: 'success',
					complete() {
						wx.redirectTo({
							url: SendRepairRouterConfig.Factory.Index
						})
					}
				})


			}

		},

	}
</script>

<style>
</style>
